/*
 * ---------------------------------------------------------------------
 * Copyright (c) 2014, 2015 All Right Reserved
 * This software is developed for study and improve coding skill ...
 *
 * Project:  Excellent Coding< EC >
 *
 * ecThreadI.h
 * This file for EC thread interface define and encapsulation.
 *
 * Eamil:   epengao@126.com
 * Author:  Peter Gao
 * Version: Intial first version.
 * --------------------------------------------------------------------
 */

#ifndef EC_THREAD_H_I
#define EC_THREAD_H_I

#include "ecBaseType.h"
#include "ecMessageI.h"
#ifdef _WIN32
#include <windows.h>
#else
#include <pthread.h>
#endif

namespace ec {

typedef enum
{
    ecThreadType_Nomal,
    ecThreadType_MsgQ,
    ecThreadType_MsgCQ,
    ecThreadType_Priority,
    ecThreadType_UnDefine = 0xFFFF
} ecThreadType;

typedef enum
{
    ecThreadStatus_Init,
    ecThreadStatus_Run,
    ecThreadStatus_Pause,
    ecThreadStatus_Stop,
    ecThreadStatus_Unknow = 0xFFFF
} ecThreadStatus;

class ecThreadI
{
public:
    virtual void Run()   = 0;
    virtual void Pause() = 0;
    virtual void Stop()  = 0;
    virtual EC_U32 PostMsg(ecMessage* pMsg = NULL) = 0;
};

} /* namespace ec */
#endif /* EC_THREAD_H_I */